package com.airlines.system.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.airlines.common.Page;
import com.airlines.system.domain.BasCompany;
import com.airlines.system.service.BasCompanyService;

/**
 * @description 公司维护
 * @Author caoyang
 * @date 2018/9/18
 */
@Controller
@RequestMapping("/basCompany")
 
public class BasCompanyController {

    private static Logger logger = LoggerFactory.getLogger(BasCompany.class);

    private static final String PREFIX = "/system/accessManagement";

    @Autowired
    private BasCompanyService basCompanyService;

    /**
     * 进入页面
     *
     * @return
     */
    @RequestMapping(value = "", method = {RequestMethod.GET})
    String toBasCompanyPage() {
        logger.info("Cuurrent Time: {}",System.currentTimeMillis());
        return PREFIX + "/basCompanyList";
    }

    /**
     * 多条件模糊 查询并且分页显示
     *
     * @param basCompany
     * @param offset
     * @param limit
     * @return
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Page list(BasCompany basCompany, String offset, String limit) {
        Page page = new Page();
        page.setPageNumber((Integer.valueOf(offset) / (Integer.valueOf(limit))));
        page.setPageSize(Integer.valueOf(limit));
        page = basCompanyService.listData(basCompany, page);
        return page;
    }
}
